﻿using System.Runtime.InteropServices;

namespace Ast.Core.Pe.Definitions
{
    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 1)]
    public struct ImportFunctionDescriptor32 : IImportFunctionDescriptor
    {
        public uint Value;

        public bool ImportByOrdinal
        {
            get { return Value >> 31 == 1; }
        }

        public uint Ordinal
        {
            get { return Value & 0xFFFF; }
        }

        public uint HintNameTableRva
        {
            get { return Value & 0x7FFFFFFF; }
        }

        public uint Size
        {
            get { return 4; }
        }
    }
}